package com.example.chat.utils;

import lombok.Data;

/**
 * 自定义异常
 * @author xiongpingan
 * @date 2021/10/13
 */
@Data
public class DOAException extends RuntimeException{

    private static final long serialVersionUID = 3657773348221896191L;
    /**
     * 状态code
     */
    private String code;

    private String raiseBy;

    public DOAException(String code, String message, Throwable e){
        super(message,e);
        this.code=code;
    }

    public DOAException(String message) {
        super(message);
    }

    public DOAException(String code, String message){
        super(message);
        this.code=code;
    }

    public DOAException(String code, String raiseBy, String message){
        super(message);
        this.code=code;
        this.raiseBy=raiseBy;
    }

    public DOAException(String message, Throwable cause, String code) {
        super(message, cause);
        this.code = code;
    }

    public DOAException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     *
     * @param e
     * @param message
     */
    public DOAException(Throwable e, String message) {
        super(DOAException.class.equals(e.getClass())?e.getLocalizedMessage() : message);
    }
}
